import scipy.io
import h5py

mat_path = 'D:/BaiduNetdiskDownload/行人检测/48_CUHK Square Dataset/CUHK_Square_ground_truth_data/CUHK_Square_ground_truth_data/train_ground_truth_data.mat'

data=h5py.File(mat_path, 'r')
x=list(data.keys())
gd = data[x[1]]
print(gd.keys())
imgsi = gd['imgsize']
imgsize = gd['imgsize'][:]
gd_list = gd['list'][:]
gd_list_0 = gd['list'][:][0]
# gd_list_0_0 = gd['list'][:][0][0]

# list_temp = list(gd_list.keys())
#w=data[x[1]]['wave']
# www=data[data[x[1]]['wave'][0][0]].value

# data = scipy.io.loadmat(mat_path)
for gd_file in gd_list[0]:
    ss = data[gd_file]
    print(ss.keys())
    tem_name = ss["imgname"][:]
    tem_box = ss["bbox"][:]
    print(len(tem_box), len(tem_name))
    print(tem_box)
    print(tem_name)

print(imgsize)
print('done')
